/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import dao.MainScheduleTaskDao;
import java.sql.Connection;
import java.util.Vector;
import pojo.CMST;

/**
 *
 * @author A7med Kotb
 */
public class MainTaskModel 
{
    private Connection con;

    public MainTaskModel(Connection con) 
    {
        this.con=con;
    }
    
    //method to add main task data
    public boolean add(CMST cmst)
    {
        MainScheduleTaskDao mstd=new MainScheduleTaskDao(con);
        return mstd.add(cmst);
    }
    public Vector<CMST> getAll()
    {
        MainScheduleTaskDao mdao=new MainScheduleTaskDao(con);
        Vector<CMST> myVect=mdao.getall();
        return myVect;
    }

    //method to update main task data in database
    public boolean update(CMST cmst) 
    {
        MainScheduleTaskDao mdao=new MainScheduleTaskDao(con);
        return mdao.update(cmst);
    }

    //method to delete main schedule task data
    public boolean delete(CMST cmst) 
    {
        MainScheduleTaskDao mdao=new MainScheduleTaskDao(con);
        return mdao.delete(cmst.getTaskName());
    }
    
    //method that return main book task
    public CMST getBookTask()
    {
        MainScheduleTaskDao mdao=new MainScheduleTaskDao(con);
        return mdao.getBookTask();
    }
    
    //method that return main media task
    public CMST getMediaTask()
    {
        MainScheduleTaskDao mdao=new MainScheduleTaskDao(con);
        return mdao.getMediaTask();
    }
}
